//
// Created by 86151 on 2024/6/7.
//

#ifndef RS485_ULTRASONIC_H
#define RS485_ULTRASONIC_H
#include "main.h"
#include "rs485.h"
#include "bsp_retarget.h"
typedef struct ultrasonic{
    uint8_t measureSign[6];
    uint8_t measureData[6];
    int distance;
}ultrasonic_;
/***
 * ultrasonicOne.distance即为超声波1的距离，同理2也是
 */
extern ultrasonic_ ultrasonicOne;
extern ultrasonic_ ultrasonicSecond;
/***
 *
 * @param flag 0x11:超声波0x11 0x12:超声波0x12
 * 把该函数放入主函数即可进行超声波的使用
 */
void sendUltrasonic(uint8_t flag);
/***
 * 把此函数放入串口回调之中，注意485中断字节为8字节
 * @param huart 传入串口句柄即可
 *
 */
void RxCpltCallbackUltrasonic(UART_HandleTypeDef *huart );
#endif //RS485_ULTRASONIC_H
